# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-nethsm
pkgver=1.0.0
pkgrel=1
pkgdesc="Python Library to manage NetHSM(s)"
url="https://github.com/Nitrokey/nethsm-sdk-py"
arch="noarch"
license="Apache-2.0 AND MIT"
depends="
	py3-certifi
	py3-cryptography
	py3-dateutil
	py3-typing-extensions
	py3-urllib3
	"
makedepends="
	py3-flit
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-docker-py
	py3-pycryptodome
	py3-pytest
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Nitrokey/nethsm-sdk-py/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/nethsm-sdk-py-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# All other tests require a running Docker daemon
	.testenv/bin/python3 -m pytest tests/test_enums.py
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
c08b195288c0a13207f447e5fcedcad63e87f960c178ec9bedbc0b82db8f99cd06b1d152fb83994f8353f85da740760eca2fdc5628ad909f1c61fa787dd2a9f9  py3-nethsm-1.0.0.tar.gz
"
